Skip to content

docs(repo): resolve Tier-4 plan-readiness audit findings#124

Merged
Sawmonabo merged 8 commits into
developfrom
docs/tier-4-plan-readiness-audit
May 29, 2026
Merged

docs(repo): resolve Tier-4 plan-readiness audit findings#124
Sawmonabo merged 8 commits into
developfrom
docs/tier-4-plan-readiness-audit

Conversation

@Sawmonabo
Copy link
Copy Markdown
Owner

@Sawmonabo Sawmonabo commented May 28, 2026

Summary

NS-16 — Tier-4 plan-readiness audit of Plan-005 (Provider Driver Contract + Capabilities), Plan-006 (Session Event Taxonomy + Audit Log), and Plan-007 remainder (Local IPC + Daemon Control, Phases 4–7). Swaps the audited working copies into the corpus and lands the cross-cutting contract shapes the audit ratified. Plan-005 + Plan-006 stay approved; Plan-007 flips approvedreview for the Tier-4 remainder Phases 4–7 design reopen — the Phases 1–3 partial PR sequence (#16/#17/#19) is audit-evidence preserved in §Tier 1 Partial PR Sequence + §Progress Log + §Retroactive Audit Memo.

Audit runbook: docs/operations/plan-implementation-readiness-audit-runbook.md. This is the Tier-4 pass (Tier-3 = NS-15 merged in PR #118; G6 satisfied).

Decisions ratified (D1–D7 + G3 overage)

# Decision Disposition
D1 Status disposition Plan-005 + Plan-006 stay approved; Plan-007 flips approvedreview per D2
D2 Plan-007 status flip Tier-4 remainder Phases 4–7 reopen the design surface; Phases 1–3 partial PR sequence unaffected (preserved as audit-evidence)
D3 Spec-006 integrity protocol ADR-018 + RFC 8785 JCS canonicalizer (UTF-16 lex-sort scalar code units) for replay-key + content-hash determinism
D4 JSON-RPC state-refusal envelope -32603 InternalError envelope + reuse of transport.unavailable code for daemon-state-degraded refusals
D5 clipanion CLI version clipanion@4.0.0-rc.4 exact-RC pin (Yarn ecosystem precedent + v3 API-incompat avoidance); BL-134 tracks stable-v4 upgrade
D6 OS-keystore source @napi-rs/keyring v1.2.0 ratified (supersedes keytar; native binding sourced from npm preserving pnpm side-effects-cache:false per Plan-001 PR #3 precedent)
D7 Spec-027 daemon-side rows Rows 2/3/7a/7b/8 integrated into security-architecture.md (capability boundary + audit emitter wiring)
G3 overage Non-Tasks budget Plan-005 2.52× + Plan-007 1.53× ratified as audit-scope-justified — 100% audit-domain content, zero redesign (runbook §Failure Modes addresses recurring-across-tiers methodology overrun, not single-tier load-bearing content additions)

G5 ephemeral-ref scrub

~100 F-XXX-Y-ZZ ID prefixes + PR #N inline refs stripped from audit-introduced plan-body text per Tier-3 Plan-003 canonical precedent (PR #118). Plan-007 baseline-preserved zones (§Tier 1 Partial PR Sequence, §Progress Log, §Retroactive Audit Memo) retain 13 PR #N refs as legitimate audit-evidence; narrative content preserved verbatim with only ephemeral prefixes scrubbed.

Anchor + path corrections (pre-commit-hook-surfaced)

The audit-introducer subagents emitted citation-shape defects the docs-anchor-check hook (lychee) caught at commit time. Root-cause fixes applied in this PR (not deferred):

  • Plan-005 Required-ADRs — phantom ADR-004 citation with non-existent filename slug (004-event-streams-are-private-not-shared.md; real ADR-004 = SQLite/Postgres). Replaced with ADR-017 (Shared Event-Sourcing Scope) — the ADR the body's runtime_node.* driver-event emission actually invokes (line 271). Header + Preconditions + Done-Checklist all updated consistently.
  • Plan-005 §CP-005-6 — broken Plan-004 filename slug (004-run-state-machine-and-events.md). Corrected to canonical 004-queue-steer-pause-resume.md.
  • Plan-005 §CP-005-5 — two 4-up relative-path traversals (../../../../docs/architecture/contracts/api-payload-contracts.md). Corrected to 1-up (../architecture/contracts/api-payload-contracts.md).
  • Plan-006 §Phase 4 narrative — Spec-015 fragment slug (#idempotency-classes not in target). Corrected to canonical #idempotency-classes-and-recovery-behavior.
  • Plan-006 §Phase 4 narrative — forbidden .agents/tmp/research/... link target ((.) no-op markdown link to transient research path). Sentence rewritten per AGENTS.md Surface-Forward-Then-Delete anti-pattern (the load-bearing content is already surface-forwarded into this plan + the api-payload-contracts.md §Plan-006 doc-mirror).

File manifest

File Change
docs/plans/005-provider-driver-contract-and-capabilities.md Working-copy swap: 4 Phases of Tasks audited; capability-flag + idempotency_class + ProviderToolMetadata cross-cutting shapes ratified; ADR-017 added to Required-ADRs (replacing phantom ADR-004); CP-005-5 + CP-005-6 resolutions surface-forwarded
docs/plans/006-session-event-taxonomy-and-audit-log.md Working-copy swap: 4 Phases of Tasks audited; RFC 8785 JCS canonicalizer ratified; DaemonSigningKeySource + OsKeystoreSealedDaemonSigningKeySource (F-006-2-02 resolution) ratified; retention_class discriminator column added (F-006-3-02 Phase 3 Design B); session_snapshots compaction-cursor columns (F-006-4-01 Phase 4 Reading (a))
docs/plans/007-local-ipc-and-daemon-control.md Working-copy swap: Phases 4–7 Tier-4 audited (run.* / repo.* / artifact.* / settings.* / daemon.* namespace handlers + Spec-027 row 2/3/7a/7b/8 daemon integrations); status flips approvedreview per D2
docs/architecture/contracts/api-payload-contracts.md Plan-007 R1/R2 state-refusal envelope + Plan-006 additive method namespace shapes (event.readAfterCursor, event.readWindow, event.subscribe) per CP-006-4 / CP-007-N
docs/architecture/security-architecture.md Spec-027 daemon-side integration rows 2/3/7a/7b/8 (capability boundary + audit emitter wiring)
docs/specs/006-session-event-taxonomy-and-audit-log.md RFC 8785 JCS canonicalizer ratification; ADR-018 reference; audit-stub retention-class additive
docs/backlog.md BL-134 (clipanion stable-v4 upgrade tracking; V1.1; criterion-gated on upstream stable release)
docs/architecture/cross-plan-dependencies.md §6 fold (below)

Tag on merge: plan-readiness-audit-tier-4-complete.

§6 fold (cross-plan-dependencies.md)

  • NS-16 :::ready:::completed; PRs checkbox [x] tier-4.
  • NS-17 promoted blockedready per the audit-chain edge NS-16 → NS-17 (audit chain remains strictly serialized through NS-21).
  • Ready set after this PR: {NS-17}; blocked set: {NS-09, NS-10, NS-18..NS-21}.

Findings ledger — 97 findings, 17 critical-root-causes (5.7:1 collapse ratio)

Per-plan breakdown: Plan-005 = 49 findings (5 critical-roots) · Plan-006 = 15 findings (6 critical-roots) · Plan-007 remainder = 33 findings (7 critical-roots, minus overlap = ~17 distinct closures). Healthy finding-instance / root-cause collapse ratio (~5.7:1) — each consuming phase independently surfaced the same upstream gap from its own vantage, not over-flagging (same pattern as Tier-3 NS-15: 31 findings → 4 roots = 7.75:1).

Root-cause critical → disposition:

Critical Disposition
RFC 8785 JCS canonicalizer unratified D3 — ADR-018 + Spec-006 RFC 8785 ratification
JSON-RPC state-refusal envelope unratified D4 — -32603 InternalError + transport.unavailable reuse
clipanion CLI version pin underspecified D5 — exact-RC pin + BL-134
OS-keystore source library unratified D6 — @napi-rs/keyring v1.2.0
Spec-027 daemon-side rows ungoverned D7 — rows 2/3/7a/7b/8 in security-architecture.md
Plan-007 Tier-4 design surface contested D2 — status flip approvedreview
Plan-006 DaemonSigningKeySource + sealed Ed25519 source F-006-2-02 resolution (in-plan)
Plan-006 retention_class discriminator column F-006-3-02 Phase 3 Design B (in-plan)
Plan-006 session_snapshots compaction-cursor columns F-006-4-01 Phase 4 Reading (a) (in-plan)
Plan-005 InterventionType enum co-location CP-005-6 resolution (in-plan)
Plan-005 CapabilityDetails wrapper + providerFailureDetail CP-005-5 resolution (in-plan)
...6 additional critical-roots dispositioned per per-plan synthesis (full disposition matrix at .agents/tmp/research/plan-readiness-audit/REVIEW.md decision block)

Calibration + gates

B1–B6: B1 avg-critical/phase (Plan-005=1.25; Plan-006=1.5; Plan-007=1.75) in band; B2 total 97 (per-plan: 49/15/33 — Plan-005 over upper band, justified by 4-Phase × audit-density) · B3 Tasks:blocking (Plan-005=1.5:1; Plan-006=4.67:1) in band ✓ · B4 user-review ~60–90 min ✓ · B5 7 substantive advisor calls (range expanded vs Tier-3 baseline; Tier-4 contract-density justified) · B6 1 status-flip (Plan-007; 0–1) ✓

G1–G6: G1 skeleton additions-only ✓ · G2 all 17 root criticals dispositioned (full matrix in REVIEW.md) ✓ · G3 non-Tasks diff Plan-005 2.52×, Plan-006 1.42×, Plan-007 1.53× — Plan-005 + Plan-007 FAIL the literal <1.5× rule; ratified as audit-scope-justified per D-G3 overage (100% audit-domain content, zero redesign) · G4 all Tasks Steps → Spec coverage + Verifies-invariant ✓ · G5 0 ephemeral F-XXX-Y-ZZ / PR #N refs in audited plan bodies (Plan-007 §Tier 1 Partial PR Sequence + §Progress Log + §Retroactive Audit Memo preserve 13 PR refs as audit-evidence per baseline carryover; verified against plan-readiness-audit-tier-4-baseline tag) ✓ · G6 Tier-3 committed (NS-15 merged in PR #118) ✓

Test plan

  • pnpm install --frozen-lockfile provisioned the worktree; all pre-commit + commit-msg hooks green (gitleaks: no leaks; lychee: 603 links / 532 OK / 0 errors / 71 excluded; docs-corpus-checks: governance cite-walk; lint-staged: prettier; commitlint: passed).
  • 0 ephemeral F-XXX-Y-ZZ / PR #N tags in Plan-005 + Plan-006 + Plan-007 plan-bodies (Plan-007 baseline preserved zones retain 13 PR refs as legitimate audit-evidence per Tier-3 Plan-003 precedent).
  • Mermaid coherence: §6 ready/blocked sets consistent with edge set; NS-16 → completed, NS-17 promoted.
  • Anchor + path corrections verified — git show :path | grep confirms 0 remnants of ADR-004, 004-run-state-machine, 4-up traversal, #idempotency-classes standalone, or transient .agents/tmp/ link targets in the audited Plan-005 + Plan-006 surfaces.

Codex review resolution

Round 4 — 182ac84

Eleven findings (5×P1) resolved in 182ac84; all eleven review threads replied + resolved. Headline P1: F9daemon.start was modeled as an in-daemon IPC handler, which is impossible (a stopped daemon hosts no IPC server to receive the call). Removed DaemonStart* from the daemon-side surface (lifecycle schemas, IPC handlers, Tier-4 method-name table, client SDK list, renderer mutating-op gate, and the action:"start" union + shared DaemonLifecycleParams in api-payload-contracts.md); cold-boot is now the ai-sidekicks daemon start CLI process-spawn path (runtime-resolved daemon path + detached spawn + DaemonHelloAck wait, T-007r-3-4). This re-aligns Plan-007 to Spec-023:76's "spawned child process of the shell" framing — the plan had drifted from the spec, not the reverse. Other P1s: F11 (DaemonKeyStore real impl + composition-root injection at Plan-022 Tier 5 per CP-007-8, not R2 — no tier inversion), F1 (R1 registers only daemon.*+settings.*; the other five namespaces attach from their owning plans), F10 (banner read is daemon-availability-tolerant), F2 (evidence_pr: 124).

Round 5 — 34ee7f7

Seven findings (1×P1) resolved in 34ee7f7; all seven threads replied + resolved — 45/45 threads resolved, mergeStateStatus: CLEAN. Headline P1 R5-6: the round-2 stub_signature signed only the compacted-row payload projection, leaving the denormalized scalar columns (id, session_id, sequence, occurred_at, category, type, actor) — read by SQL filters and envelope reconstruction — unbound; an at-rest scalar edit could forge an actor/type while both stub_signature and the anchor over the frozen row_hash still verified. The verifier now adds a scalar-binding check (each scalar column byte-equals its payload-projection counterpart) → a new failureMode: 'stub_scalar_mismatch', an additive-MINOR enum extension 10→11 per ADR-018 §Decision #8. Other findings: R5-1 (DaemonStatusReadResult API mirror reconciled to the canonical processState shape), R5-2 (Spec-007 amended to disambiguate daemon start as a process-spawn capability, not a daemon.start IPC handler), R5-3 (separate DaemonStopRequest/DaemonRestartRequest mirror schemas carrying idleDrainDeadlineMs), R5-4 (Plan-005 DriverClient interface enumerates exactly the 7 client-facing methods, not the stale 11), R5-5 (Plan-005 storage summary lists all four Phase-2 SQLite tables), R5-7 (R2-T6 re-scoped to the emission-side securityCritical boundary R2 owns).

Round-4 deferrals, now resolved. The two round-4 "named but not chased" divergences are closed: (a) the api-payload-contracts.md DaemonStatusReadResult mirror is reconciled to the canonical processState shape (R5-1); (b) the Plan-007 CLI §Files inventory (one-vs-three daemon-lifecycle.ts) is fixed in 8631a1d, which also reconciled the broader R3 §Files block to its authoritative Tasks — added exit-codes.ts (T-3-3) + settings.ts (T-3-6), fixed the daemon-status.ts citation (T-3-3→T-3-5), and removed the session-*/meta.ts orphans (the CLI session surface is owned by Plan-001 Phase 5; --version/--help are clipanion Cli-builder built-ins). docs/specs/007-local-ipc-and-daemon-control.md:74 is now amended (R5-2) — a real defect in the approved spec's IPC-method listing, not an intentional carry-forward.

Remaining deferrals (each owned by its own pending audit). DaemonStart survives in the capability sense (the shell boots the daemon, realized by spawn) in three Tier-8 peer artifacts revisited by their own audits: docs/specs/023-desktop-shell-and-renderer.md:76,221, docs/plans/023-desktop-shell-and-renderer.md:62, docs/operations/local-daemon-runbook.md. Amending a peer plan/spec/runbook to restate something already correct in the capability sense is out of this PR's scope.

Refs: Plan-005, Plan-006, Plan-007, Spec-006, Spec-007, ADR-017, ADR-018, BL-134

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant